﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewDiaryEntry.aspx.cs" Inherits="NewDiaryEntry"
    MasterPageFile="~/MasterPage.master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <div class="col1">
        <asp:Label ID="lbSelectedDate" runat="server" Font-Bold="True" Font-Size="X-Large"
            Font-Underline="True"></asp:Label>
        <br />
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
        <br />
        <asp:Label ID="Label2" runat="server" Text="Tiêu đề" Width="15%"></asp:Label>
        <asp:TextBox ID="txtTitle" runat="server" Width="70%"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
            ErrorMessage="Title is required" SetFocusOnError="True">*</asp:RequiredFieldValidator>
        <br />
        <br />
        <asp:Label ID="Label3" runat="server" Text="Nội Dung" Width="15%"></asp:Label>
        <asp:TextBox ID="txtContent" runat="server" Height="159px" TextMode="MultiLine" Width="70%"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtContent"
            ErrorMessage="Content is required" SetFocusOnError="True">*</asp:RequiredFieldValidator>
        <br />
        <br />
        <asp:Label ID="Label4" runat="server" Width="15%"></asp:Label>
        <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Lưu Nhật Ký" />
        <asp:CustomValidator ID="CustomValidator1" runat="server" Display="None" ErrorMessage="CustomValidator"></asp:CustomValidator>
        <br />
        <br />
        <br />
        <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/NewEvent.aspx">Thêm 
            Sự Kiện Mới</asp:HyperLink>
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
            BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" 
            CellPadding="3" DataKeyNames="EventID"
            DataSourceID="sdsEvents" ForeColor="Black" GridLines="Vertical" 
            Width="100%" onrowdeleting="GridView1_RowDeleting">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink3" runat="server" 
                            NavigateUrl='<%# "NewEvent.aspx?EventID=" + Eval("EventID") %>'>Edit</asp:HyperLink>
                        &nbsp;|
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("EventID") %>'
                            CommandName="Delete" CausesValidation="False">Delete</asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:BoundField DataField="EventName" HeaderText="EventName" SortExpression="EventName" />
                <asp:BoundField DataField="EventDescription" HeaderText="EventDescription" SortExpression="EventDescription" />
                <asp:BoundField DataField="EventDate" HeaderText="EventDate" SortExpression="EventDate" />
            </Columns>
            <FooterStyle BackColor="#CCCCCC" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <EmptyDataTemplate>
                <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Italic="True" ForeColor="Red"
                    Style="text-align: center" Width="100%">No Event</asp:Label>
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="#CCCCCC" />
        </asp:GridView>
        <asp:SqlDataSource ID="sdsEvents" runat="server" ConnectionString="<%$ ConnectionStrings:DiaryOnlineConnectionString %>"
            
            SelectCommand="SELECT [EventID], [EventName], [EventDescription], [EventDate] FROM [DiaryEvent] WHERE (([DiaryID] = @DiaryID) AND ([EventDate] &gt;= @EventDate))" 
            DeleteCommand="DELETE FROM DiaryEvent Where EventID = @EventID">
            <SelectParameters>
                <asp:SessionParameter Name="DiaryID" SessionField="DiaryID" Type="Int32" />
                <asp:SessionParameter DbType="Date" Name="EventDate" SessionField="SelectedDate" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="EventID" />
            </DeleteParameters>
        </asp:SqlDataSource>
    </div>
    <div class="col2">
        <asp:HyperLink ID="HyperLink1" runat="server" Font-Bold="True" Font-Size="X-Large"
            NavigateUrl="~/Default.aspx">Trang Nhật Ký Chính</asp:HyperLink>
        <br />
        <br />
        <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black"
            DayNameFormat="Shortest" Font-Names="Times New Roman" Font-Size="10pt" ForeColor="Black"
            Height="220px" NextPrevFormat="FullMonth" OnSelectionChanged="Calendar1_SelectionChanged"
            TitleFormat="Month" Width="400px">
            <SelectedDayStyle BackColor="#CC3333" ForeColor="White" />
            <SelectorStyle BackColor="#CCCCCC" Font-Bold="True" Font-Names="Verdana" Font-Size="8pt"
                ForeColor="#333333" Width="1%" />
            <TodayDayStyle BackColor="#CCCC99" />
            <OtherMonthDayStyle ForeColor="#999999" />
            <DayStyle Width="14%" />
            <NextPrevStyle Font-Size="8pt" ForeColor="White" />
            <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" ForeColor="#333333"
                Height="10pt" />
            <TitleStyle BackColor="Black" Font-Bold="True" Font-Size="13pt" ForeColor="White"
                Height="14pt" />
        </asp:Calendar>
    </div>
    <div style="clear: both">
    </div>
</asp:Content>
